﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace XBLIGUK2011Talk2.HUD
{
    public class HUDCheckBox : HUDObject
    {
        public enum States
        {
            Checked,
            UnChecked
        }

        public string Text;

        public States CurrentState = States.UnChecked;

        public Color Shadow = Color.MediumPurple;
        SpriteFont font;

        public HUDCheckBox(string name, string text, int top, int left) : base(name,top,left)
        {
            Top = top;
            Left = left;

            Text = text;

            Shadow.A = (byte)(255 * .25f);
        }

        public override void Update(GameTime gameTime)
        {
            bounds = new Rectangle(Left, Top + (int)Parent.Top, (int)font.MeasureString(Text).X + 42, 32);
            base.Update(gameTime);
        }

        public override void Draw(GameTime gameTime)
        {
            if(CurrentState == States.UnChecked)
                spriteBatch.Draw(Game.Content.Load<Texture2D>("Textures/HUD/HUSChkBoxOff"), new Rectangle(Left, Top + (int)Parent.Top, 32, 32), Color.White);
            else
                spriteBatch.Draw(Game.Content.Load<Texture2D>("Textures/HUD/HUSChkBoxOn"), new Rectangle(Left, Top + (int)Parent.Top, 32, 32), Color.White);

            if (font == null)
                font = Game.Content.Load<SpriteFont>("Fonts/hudFont");

            spriteBatch.DrawString(font, Text, new Vector2(Left + 40, Top + (int)Parent.Top + (font.LineSpacing / 2) + 2), Shadow);
            spriteBatch.DrawString(font, Text, new Vector2(Left + 42, Top + (int)Parent.Top + (font.LineSpacing / 2)), Color.Purple);
        }
    }
}
